[SPIR-V] Support vk::SampledTexture2D in offload test suite.#748
[SPIR-V] Support vk::SampledTexture2D in offload test suite.#748
vk::SampledTexture2D in offload test suite.#748Conversation
| float2 uv_min = BaseUV + offset * 2.0; | ||
|
|
||
| // Only check the first thread in the quad where UV is exactly (0.5, 0.5). | ||
| if (all(GTid.xy == 0)) { |
There was a problem hiding this comment.
nit: it would IMO be clearer to early return on this condition to clarify the shader:
float4 main(float4 Pos : SV_POSITION) {
uint2 GTid = (uint2)Pos;
if (!all(GTid == 0))
return float4(0, 0, 0, 0);There was a problem hiding this comment.
Sorry I didn't quite get your comment (and above)..!
it's intentional that we do not early return before this if condition to correctly calculate the gradient. Although the threads that do not meet the if condition do not execute, their coordinate will be used to calculate the correct mip level for the first pixel.
PLMK if I'm misunderstanding anything.
cc: @s-perron (original author)
There was a problem hiding this comment.
These tests are invalid. You need to move the sample instructions with an implicit LOD before the if statement. Store the result to a temp, and then have just the one thread write to the resource.
| // 1. Magnification UVs: Small delta (0.0001). LOD < 0. GPU selects MagFilter. | ||
| float2 uv_mag = BaseUV + offset * 0.0001; | ||
|
|
||
| // 2. Minification UVs: Large delta (2.0). LOD > 0. GPU selects MinFilter. | ||
| float2 uv_min = BaseUV + offset * 2.0; |
There was a problem hiding this comment.
Given the condition below all(GTid.xy == 0), offset is essentially trunc(float2(0, 0)), to uv_mag and uv_min are the same value BaseUV no?
CombinedImageSamplerresource type..Sample()forvk::SampledTexture2D.The test is exactly the same as Texture2D.Sample.test.yaml.
Part of microsoft/DirectXShaderCompiler#7979